﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infinity.Common;
using NUnit.Framework;

namespace Infinity.Tests.Common
{
	public class CommandParameterManagerTestClass
	{
		[Test]
		public void ParseTest()
		{
			var manager = new SimpleCommandManager();
			manager.CreateRule("--version",
			                   0,
			                   @params =>
				                   {
					                   Console.WriteLine("Command Argument Manager");
					                   Console.WriteLine("Version: 0.1v");
				                   });

			manager.CreateRule("--about", 0, _ => Console.WriteLine("Created by Tamas Szabo"));

			manager.CreateRule("/write", -1, @params => Console.WriteLine("[Console] {0}", string.Join(" ", @params)));

			manager.Parse("--version", "/write", "Hello", " World! ", "--about");
			manager.Parse("/write Hello EveryBody! What's up? --about --version /write How's going?");

			manager = new SimpleCommandManager();
			manager.CreateRule("-user", 1, x => Console.WriteLine("User: {0}", x));
			manager.CreateRule("-password", 1, x => Console.WriteLine("Password: {0}", x));

			manager.Parse("-user szabotam -password 24325");
		}
	}
}